.class public Lcom/glympse/platform/common/Track;
.super Lcom/glympse/platform/GVector$TrackLocs;
.source "Track.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/glympse/platform/common/Track$TrackLoc;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/glympse/platform/GVector$TrackLocs;"
    }
.end annotation


# static fields
.field public static final TRACK_DURATION:J = 0x927c0L


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 19
    invoke-direct {p0}, Lcom/glympse/platform/GVector$TrackLocs;-><init>()V

    return-void
.end method


# virtual methods
.method public AddLocation(JIIJ)Z
    .locals 11
    .parameter "lPointTime"
    .parameter "nLatitudeE6"
    .parameter "nLongitudeE6"
    .parameter "lBaseTime"

    .prologue
    .line 27
    const-wide/16 v9, 0x0

    cmp-long v9, p5, v9

    if-gtz v9, :cond_0

    .line 29
    const/4 v9, 0x0

    .line 166
    .end local p5
    :goto_0
    return v9

    .line 33
    .restart local p5
    :cond_0
    cmp-long v9, p5, p1

    if-lez v9, :cond_1

    sub-long v9, p5, p1

    move-wide v1, v9

    .line 36
    .local v1, lElapsedTime:J
    :goto_1
    const-wide/32 v9, 0x927c0

    cmp-long v9, v1, v9

    if-ltz v9, :cond_2

    .line 38
    const/4 v9, 0x0

    goto :goto_0

    .line 33
    .end local v1           #lElapsedTime:J
    :cond_1
    const-wide/16 v9, 0x0

    move-wide v1, v9

    goto :goto_1

    .line 51
    .restart local v1       #lElapsedTime:J
    :cond_2
    const/4 v3, -0x1

    .local v3, nInsert:I
    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->size()I

    move-result v4

    .line 52
    .local v4, nSize:I
    if-lez v4, :cond_5

    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->lastElement()Ljava/lang/Object;

    move-result-object p5

    .end local p5
    check-cast p5, Lcom/glympse/platform/common/Track$TrackLoc;

    move-object/from16 v8, p5

    .line 53
    .local v8, oPrev:Lcom/glympse/platform/common/Track$TrackLoc;
    :goto_2
    const/4 v7, 0x0

    .line 57
    .local v7, oNext:Lcom/glympse/platform/common/Track$TrackLoc;
    if-eqz v8, :cond_4

    iget-wide v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    cmp-long v9, p1, v9

    if-gez v9, :cond_4

    .line 64
    const/4 v9, 0x1

    if-le v4, v9, :cond_3

    .line 67
    move-object v7, v8

    .line 68
    const/4 v9, 0x2

    sub-int v9, v4, v9

    invoke-virtual {p0, v9}, Lcom/glympse/platform/common/Track;->elementAt(I)Ljava/lang/Object;

    move-result-object v8

    .end local v8           #oPrev:Lcom/glympse/platform/common/Track$TrackLoc;
    check-cast v8, Lcom/glympse/platform/common/Track$TrackLoc;

    .line 72
    .restart local v8       #oPrev:Lcom/glympse/platform/common/Track$TrackLoc;
    iget-wide v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    cmp-long v9, p1, v9

    if-ltz v9, :cond_3

    .line 74
    const/4 v9, 0x1

    sub-int v3, v4, v9

    .line 79
    :cond_3
    if-gez v3, :cond_4

    .line 81
    const/4 v3, 0x0

    .line 82
    const/4 v8, 0x0

    .line 85
    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->elements()Ljava/util/Enumeration;

    move-result-object v0

    .local v0, iter:Ljava/util/Enumeration;
    :goto_3
    invoke-interface {v0}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v9

    if-nez v9, :cond_6

    .line 106
    .end local v0           #iter:Ljava/util/Enumeration;
    :cond_4
    if-eqz v7, :cond_8

    iget-wide v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    cmp-long v9, v9, p1

    if-nez v9, :cond_8

    .line 109
    iget-object v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLatitudeE6()I

    move-result v9

    if-ne v9, p3, :cond_7

    iget-object v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLongitudeE6()I

    move-result v9

    if-ne v9, p4, :cond_7

    .line 111
    const/4 v9, 0x0

    goto :goto_0

    .line 52
    .end local v7           #oNext:Lcom/glympse/platform/common/Track$TrackLoc;
    .end local v8           #oPrev:Lcom/glympse/platform/common/Track$TrackLoc;
    .restart local p5
    :cond_5
    const/4 v9, 0x0

    move-object v8, v9

    goto :goto_2

    .line 87
    .end local p5
    .restart local v0       #iter:Ljava/util/Enumeration;
    .restart local v7       #oNext:Lcom/glympse/platform/common/Track$TrackLoc;
    .restart local v8       #oPrev:Lcom/glympse/platform/common/Track$TrackLoc;
    :cond_6
    invoke-interface {v0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/glympse/platform/common/Track$TrackLoc;

    .line 90
    .local v5, oCur:Lcom/glympse/platform/common/Track$TrackLoc;
    move-object v8, v7

    .line 91
    move-object v7, v5

    .line 94
    iget-wide v9, v5, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    cmp-long v9, p1, v9

    if-lez v9, :cond_4

    .line 100
    add-int/lit8 v3, v3, 0x1

    goto :goto_3

    .line 116
    .end local v0           #iter:Ljava/util/Enumeration;
    .end local v5           #oCur:Lcom/glympse/platform/common/Track$TrackLoc;
    :cond_7
    new-instance v9, Lcom/glympse/platform/LocPointE6;

    invoke-direct {v9, p3, p4}, Lcom/glympse/platform/LocPointE6;-><init>(II)V

    iput-object v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    .line 117
    const/4 v9, 0x1

    goto/16 :goto_0

    .line 121
    :cond_8
    if-eqz v8, :cond_a

    iget-wide v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    cmp-long v9, v9, p1

    if-nez v9, :cond_a

    .line 124
    iget-object v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLatitudeE6()I

    move-result v9

    if-ne v9, p3, :cond_9

    iget-object v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLongitudeE6()I

    move-result v9

    if-ne v9, p4, :cond_9

    .line 126
    const/4 v9, 0x0

    goto/16 :goto_0

    .line 131
    :cond_9
    new-instance v9, Lcom/glympse/platform/LocPointE6;

    invoke-direct {v9, p3, p4}, Lcom/glympse/platform/LocPointE6;-><init>(II)V

    iput-object v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    .line 132
    const/4 v9, 0x1

    goto/16 :goto_0

    .line 138
    :cond_a
    if-eqz v7, :cond_b

    iget-object v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLatitudeE6()I

    move-result v9

    if-ne v9, p3, :cond_b

    iget-object v9, v7, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLongitudeE6()I

    move-result v9

    if-ne v9, p4, :cond_b

    .line 140
    const/4 v9, 0x0

    goto/16 :goto_0

    .line 147
    :cond_b
    if-eqz v8, :cond_c

    iget-object v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLatitudeE6()I

    move-result v9

    if-ne v9, p3, :cond_c

    iget-object v9, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v9}, Lcom/glympse/platform/LocPointE6;->getLongitudeE6()I

    move-result v9

    if-ne v9, p4, :cond_c

    .line 149
    iput-wide p1, v8, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    .line 150
    const/4 v9, 0x0

    goto/16 :goto_0

    .line 154
    :cond_c
    new-instance v6, Lcom/glympse/platform/common/Track$TrackLoc;

    new-instance v9, Lcom/glympse/platform/LocPointE6;

    invoke-direct {v9, p3, p4}, Lcom/glympse/platform/LocPointE6;-><init>(II)V

    invoke-direct {v6, v9, p1, p2}, Lcom/glympse/platform/common/Track$TrackLoc;-><init>(Lcom/glympse/platform/LocPointE6;J)V

    .line 157
    .local v6, oNew:Lcom/glympse/platform/common/Track$TrackLoc;
    if-gez v3, :cond_d

    .line 159
    invoke-virtual {p0, v6}, Lcom/glympse/platform/common/Track;->addElement(Ljava/lang/Object;)V

    .line 166
    :goto_4
    const/4 v9, 0x1

    goto/16 :goto_0

    .line 163
    :cond_d
    invoke-virtual {p0, v6, v3}, Lcom/glympse/platform/common/Track;->insertElementAt(Ljava/lang/Object;I)V

    goto :goto_4
.end method

.method public DumpTracks()V
    .locals 6

    .prologue
    const/4 v5, 0x7

    .line 201
    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->elements()Ljava/util/Enumeration;

    move-result-object v0

    .local v0, iter:Ljava/util/Enumeration;
    :goto_0
    invoke-interface {v0}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v2

    if-nez v2, :cond_0

    .line 207
    return-void

    .line 203
    :cond_0
    invoke-interface {v0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/glympse/platform/common/Track$TrackLoc;

    .line 205
    .local v1, oCur:Lcom/glympse/platform/common/Track$TrackLoc;
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "TRACK: "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-wide v3, v1, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    invoke-virtual {v2, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ","

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, v1, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v3}, Lcom/glympse/platform/LocPointE6;->GetLatitude()D

    move-result-wide v3

    invoke-static {v3, v4, v5}, Lcom/glympse/platform/common/Helpers;->DoubleToStr(DI)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ","

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v3, v1, Lcom/glympse/platform/common/Track$TrackLoc;->m_oLocPointE6:Lcom/glympse/platform/LocPointE6;

    invoke-virtual {v3}, Lcom/glympse/platform/LocPointE6;->GetLongitude()D

    move-result-wide v3

    invoke-static {v3, v4, v5}, Lcom/glympse/platform/common/Helpers;->DoubleToStr(DI)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public RemoveOldLocations(JZ)Z
    .locals 7
    .parameter "lBaseTime"
    .parameter "fAbsolute"

    .prologue
    .line 172
    const/4 v0, 0x0

    .line 175
    .local v0, fDeleted:Z
    :goto_0
    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->isEmpty()Z

    move-result v5

    if-eqz v5, :cond_1

    .line 194
    :cond_0
    return v0

    .line 178
    :cond_1
    invoke-virtual {p0}, Lcom/glympse/platform/common/Track;->firstElement()Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lcom/glympse/platform/common/Track$TrackLoc;

    iget-wide v3, v5, Lcom/glympse/platform/common/Track$TrackLoc;->m_lTime:J

    .line 179
    .local v3, lLocTime:J
    cmp-long v5, p1, v3

    if-ltz v5, :cond_2

    .line 180
    sub-long v5, p1, v3

    move-wide v1, v5

    .line 183
    .local v1, lElapsed:J
    :goto_1
    if-eqz p3, :cond_3

    const-wide/16 v5, 0x0

    :goto_2
    cmp-long v5, v1, v5

    if-ltz v5, :cond_0

    .line 189
    const/4 v5, 0x0

    invoke-virtual {p0, v5}, Lcom/glympse/platform/common/Track;->removeElementAt(I)V

    .line 191
    const/4 v0, 0x1

    goto :goto_0

    .line 180
    .end local v1           #lElapsed:J
    :cond_2
    const-wide/16 v5, -0x1

    move-wide v1, v5

    goto :goto_1

    .line 183
    .restart local v1       #lElapsed:J
    :cond_3
    const-wide/32 v5, 0x927c0

    goto :goto_2
.end method
